package utilities;

import com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_core.*;
import com.googlecode.javacv.cpp.opencv_calib3d.*;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;

/**
 *
 * @author Ashen
 */
public class ProcessImage {
    //this class will contain methods to proces the image to improve the quality

    IplConvKernel kernel = cvCreateStructuringElementEx(7, 7, 3, 3, CV_SHAPE_ELLIPSE, null);

    IplImage smooth(IplImage img, int kernelsize) {
        IplImage mean= cvCreateImage(cvGetSize(img), 8, 1);
        cvSmooth(img, mean, kernelsize, kernelsize);
        return mean;
    }

    IplImage open(IplImage img) {
        IplImage open = cvCreateImage(cvGetSize(img), 8, 1);
        cvErode(img, open, kernel, 2);
        cvDilate(open, open, kernel, 2);
        return open;
    }

    IplImage close(IplImage img) {
        IplImage close= cvCreateImage(cvGetSize(img), 8, 1);
        cvDilate(img, close, kernel, 2);
        cvErode(close, close, kernel, 2);
        return close;
    }
}
